import { createRouter, createWebHashHistory } from "vue-router";  
// 引入页面
const Home = () => import("@/views/Home.vue")
const Cart = () => import("@/views/Cart.vue")
const Detail = () => import("@/views/Detail.vue")
const List = () => import("@/views/List.vue")
const Login = () => import("@/views/Login.vue")
const My = () => import("@/views/My.vue")
const Register = () => import("@/views/Register.vue")

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/cart',
    name: 'Cart',
    component: Cart
  },
  {
    path: '/detail',
    name: 'Detail',
    component: Detail
  },
  {
    path: '/list',
    name: 'List',
    component: List
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/my',
    name: 'My',
    component: My
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router